package com.lijy.superseckill.service;

import com.lijy.superseckill.dao.UserDao;
import com.lijy.superseckill.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
    @Autowired
    UserDao userDao;

    public User getById(int id) {
        return userDao.getById(id);
    }

    @Transactional
    public Boolean insert() {

        User u1 = new User();
        u1.setId(3);
        u1.setName("ww");
        userDao.insert(u1);

        User u2 = new User();
        u2.setId(2);
        u2.setName("zz");
        userDao.insert(u2);

        return true;
    }
}
